package structural_pattern.flyweight_pattern;

public class MainFlyweight {

    public static void main(String[] args) {
        IgoChessman black1,black2,black3,white1,white2,white3;
        IgonChessFactory igonChessFactory;

        //获取享元工厂对象
        igonChessFactory = IgonChessFactory.getInstance();

        //通过享元工厂获取3颗黑子

        black1 = igonChessFactory.getIgoChessman("b");
        black2 = igonChessFactory.getIgoChessman("b");
        black3 = igonChessFactory.getIgoChessman("b");

        //通过享元工厂获取3颗白子

        white1 = igonChessFactory.getIgoChessman("w");
        white2 = igonChessFactory.getIgoChessman("w");
        white3 = igonChessFactory.getIgoChessman("w");

        //显示棋子
        black1.disPlay();
        black2.disPlay();
        black3.disPlay();
        white1.disPlay();
        white2.disPlay();
        white3.disPlay();
    }
}
